		<?php $this->load->view('layout/lib_chart');?>
		
		
		<?php 
			date_default_timezone_set('Asia/Krasnoyarsk');
			//print_r($row);
			$y_start	=	date('Y');
			$y_end		=	date('Y')+59;
			$n	=	$y_end - $y_start;
			$data	=	array();
			$data_xplotline	=	array();
			$data_yplotline	=	array();
			for($i = 0; $i < $n; $i+=2)
			{
					$x	=	$y_start+$i;
					
					$y_sb	=	$row['SB']*pow((1+($row['SBR']/100)),$i);
					$y_sb	=	round(floatval($y_sb));
					$temp_sb	=	array($i,$y_sb);
					$sb[]	=	$temp_sb;
					
					$y_ss	=	$row['SS']*pow((1+($row['SSR']/100)),$i);
					$y_ss	=	round(floatval($y_ss));
					$temp_ss	=	array($i,$y_ss);
					$ss[]	=	$temp_ss;
					
					$y_us	=	$row['US']*pow((1+($row['USR']/100)),$i);
					$y_us	=	round(floatval($y_us));
					$temp_us	=	array($i,$y_us);
					$us[]	=	$temp_us;
					
					$y_b	=	$row['B']*pow((1+($row['BR']/100)),$i);
					$y_b	=	round(floatval($y_b));
					$temp_b	=	array($i,$y_b);
					$b[]	=	$temp_b;
					
					$y_fd	=	$row['FD']*pow((1+($row['FDR']/100)),$i);
					$y_fd	=	round(floatval($y_fd));
					$temp_fd	=	array($i,$y_fd);
					$fd[]	=	$temp_fd;
					
					$y_ip	=	$row['IP']*pow((1+($row['IPR']/100)),$i);
					$y_ip	=	round(floatval($y_ip));
					$temp_ip	=	array($i,$y_ip);
					$ip[]	=	$temp_ip;
					
					$y_cpf	=	$row['CPF']*pow((1+($row['CPFR']/100)),$i);
					$y_cpf	=	round(floatval($y_cpf));
					$temp_cpf	=	array($i,$y_cpf);
					$cpf[]	=	$temp_cpf;
					
					$y=$y_sb+$y_ss+$y_us+$y_b+$y_fd+$y_ip+$y_cpf;
					//$y*=10000;
					$y_temp	=	array($x,$y);
					$Y[]	=	$y_temp;
				//if($i == 2011 || $i == 2070){
					
					$data_yplotline[]	=	array(
										'value'	=>	$y_sb,
										'width'	=> 1,
									    'color'	=> 'green',
										'dashStyle'	=> 'dash',
										'label'	=>array(
														'align'	=>	'right',
														'y'	=>	12,
														'x'	=>	0
					)
					);
				//}
			}
			
			$data_xplotline[0]	=	array(
				'value'	=>	($y_start/2000)*10000,
				'width'	=> 2,
			    'color'	=> 'green',
				'dashStyle'	=> 'solid',
				'label'	=>array(
								'align'	=>	'right',
								'y'	=>	12,
								'x'	=>	0
								) 
			);
			$data_xplotline[1]	=	array(
									'value'	=>	($y_end/2000)*10000,
									'width'	=> 2,
								    'color'	=> 'green',
									'dashStyle'	=> 'solid',
									'label'	=>array(
													'align'	=>	'right',
													'y'	=>	12,
													'x'	=>	0
			)
			);
			$data_xplotline	=	json_encode($data_xplotline);
			$data_yplotline	=	json_encode($data_yplotline);
			//$data	=	array($sb,$ss);
			//$data	=	json_encode($data);
			$sb	=	json_encode($sb);
			$ss	=	json_encode($ss);
			$us	=	json_encode($us);
			$b	=	json_encode($b);
			$fd	=	json_encode($fd);
			$ip	=	json_encode($ip);
			$cpf	=	json_encode($cpf);
			$Y	=	json_encode($Y);
			//print_r($Y);
		?>
		<!-- 2. Add the JavaScript to initialize the chart on document ready -->
		<script type="text/javascript">

		var chart;
		$(document).ready(function() {
			chart = new Highcharts.Chart({
				chart: {
					renderTo: 'container',
					defaultSeriesType: 'spline',
					//inverted: true,
					width: 800,
					style: {
						margin: '0 auto'
					}
				},
				title: {
					text: ''
				},
				subtitle: {
					text: ''
				},
				xAxis: {
					reversed: false,
					title: {
						enabled: true,
						text: 'Years'
					},
					labels: {
						formatter: function() {
							return this.value +'';
						}
					},
					maxPadding: 0.05,
					//min : 2000,
					//max :2080,
					plotLines : <?php echo $data_xplotline;?>,
					//showLastLabel: true,
					//categories:['2010','2011','2012']
				},
				yAxis: [
						{
					title: {
						text: 'Current Holdings'
					},
					labels: {
						formatter: function() {
							return this.value + '$';
						}
					},
					maxPadding: 0.05,
					lineWidth: 1,
					//plotLines : <?php echo $data_yplotline;?>,
					gridLineWidth : 0
					}
				],
				legend: {
					enabled: false
				},
				tooltip: {
					formatter: function() {
						return ''+
							this.x +' : '+ this.y +'$';
					}
				},
				plotOptions: {
					spline: {
						marker: {
							enable: false
						}
					}
				},
				point:{
					sliced: false,
					color: '#fff'
				},
				series: [
				{
					name: 'FD',
					data: <?php echo $Y;?>,
					type: 'line',
					marker:{symbol: '',radius: 2}
				}
				]
			});
			
			
		});
				
		</script>
		<!-- 3. Add the container -->
		<div>Current holding <?php //echo $param?></div>
		<table>
			<tr>
				<td><div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div></td>
			</tr>
		</table>
		